#!/usr/bin/env python3
# -*- coding: utf-8 -*-

import re

def check_svg_arcs():
    """检查SVG文件中的弧线命令"""
    try:
        with open('python-svg/k717_profile_with_arcs.svg', 'r', encoding='utf-8') as f:
            content = f.read()
        
        # 查找所有弧线命令
        arc_commands = re.findall(r'A [0-9]+\.[0-9]+ [0-9]+\.[0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+\.[0-9]+ [0-9]+\.[0-9]+', content)
        print('SVG文件中的弧线命令:')
        for i, cmd in enumerate(arc_commands):
            print(f'  {i+1}: {cmd}')
        
        # 查找path元素
        path_match = re.search(r'<path d="([^"]+)"', content)
        if path_match:
            path_data = path_match.group(1)
            print(f'\n完整路径数据: {path_data[:200]}...')  # 只显示前200个字符
            
            # 查找弧线部分
            arc_parts = re.findall(r'A [0-9]+\.[0-9]+ [0-9]+\.[0-9]+ [0-9]+ [0-9]+ [0-9]+ [0-9]+\.[0-9]+ [0-9]+\.[0-9]+', path_data)
            print(f'\n路径中的弧线部分:')
            for i, arc in enumerate(arc_parts):
                print(f'  {i+1}: {arc}')
        
    except Exception as e:
        print(f"检查SVG文件时出错: {e}")

if __name__ == "__main__":
    check_svg_arcs()
